utils = {}; utils.galleryresize = function (isonload) { if ($(".photo_gallery_container").length > 0) { var wgc = 0, wgi = 0, ncnt = 0, nwgi = 0, nhgi = 0, sfw = 0, sfh = 0, sf = 0; $(".photo_gallery_container").each(function () { var mycontainer = $(this); var $parent = mycontainer.parent(); mycontainer.appendTo("body").css({ height: "0px", overflow: "hidden" }); wgc = $parent.width(); wgi = 250; ncnt = Math.floor(wgc / wgi); margin = parseInt($(".photo_gallery", mycontainer).css("margin-left"), 10) + parseInt($(".photo_gallery", mycontainer).css("margin-right"), 10); nwgi = Math.floor(wgc / ncnt) - margin; $(".photo_gallery", mycontainer).width(nwgi); $(".photo_gallery", mycontainer).each(function () { setmarginleft = false; mygalleryitem = $(this); if (isonload) { var obj = $("img", mygalleryitem); obj.data("width", obj.width()).data("height", obj.height()); } hic = mygalleryitem.height(); wic = mygalleryitem.width(); hgi = $("img", mygalleryitem).data("height"); wgi = $("img", mygalleryitem).data("width"); sfh = hic / hgi; sfw = wic / wgi; if (sfh < sfw) { sf = sfw; } else { sf = sfh; } $("img", mygalleryitem).width(wgi * sf).css("max-width", "none"); nwgi = $("img", mygalleryitem).width(); nhgi = $("img", mygalleryitem).height(); if (sfh < sfw) { margintop = ((nhgi - hic) / 2) * -1; $("img", mygalleryitem).css("margin-top", margintop).css("margin-left", 0); } else { marginleft = ((nwgi - wic) / 2) * -1; $("img", mygalleryitem).css("margin-top", 0).css("margin-left", marginleft); } }); mycontainer.appendTo($parent).css({ height: "auto", overflow: "visible" }); }); } }; utils.mobilemenu = function () { /* var $mi; var $topmenu = $("#topMenu"); var $mm = $topmenu.clone().attr("id", "mobileMenu").addClass("submenu0").insertAfter("#cp-mobileTopBar"); $("ul", $mm).each(function () {$(this).hide().addClass("submenu" + $(this).parents("li").length);});*/ jQuery("#mobileMenuButton" ).click(function() { jQuery("#mobileMenuWrapper").toggleClass('toggleMobileMenu'); jQuery("#mobileMenuButton").toggleClass('closeMenu'); }); /* $("").insertBefore($(".hasvisiblechild > a", $mm)).on("click", function (e) {$(this).siblings("ul").slideToggle(); });*/ $('#mobileMenu li span.mmToggle').click(function() { $(this).toggleClass("active"); $(this).siblings("ul").slideToggle(); }); // $("#mobileMenu").wrap( "
" ); $("#mobileMenu").appendTo("#mobileMenuWrapper"); $('#cp-MobileLSSContainer').appendTo("#mobileMenuWrapper"); // $(".cp-LSwitchSearchContainer").clone().insertAfter("#mobileMenu"); $("").insertBefore("#mobileMenu"); }; utils.sidemenu = function () { var $mainmenu = $("#mainmenu"); var x = $("li.selected", $mainmenu).parentsUntil( $mainmenu, "li" ).length ? $("li.selected", $mainmenu).parentsUntil( $mainmenu, "li" ) : $("li.selected", $mainmenu); if (!$(">ul", $(x[x.length - 1])).length) { x = $mainmenu.clone();$("li", x).first().remove(); } var y = $("